<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name}">
        </div>
    </div>

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Icon')}:</label>
            <div class="col-xs-12 col-sm-8">
                <div class="input-group">
                    <input id="c-icon"  class="form-control" size="50" name="row[icon]" type="text" value="{$row.icon}">
                    <div class="input-group-addon no-border no-padding">
                        <span><button type="button" id="plupload-icon" class="btn btn-danger plupload" data-input-id="c-icon" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false" data-preview-id="p-icon"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                        <span><button type="button" id="fachoose-icon" class="btn btn-primary fachoose" data-input-id="c-icon" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                    </div>
                    <span class="msg-box n-right" for="c-icon"></span>
                </div>
                <ul class="row list-inline plupload-preview" id="p-icon"></ul>
            </div>
        </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
        <div class="col-xs-12 col-sm-8">

            <select  id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
                {foreach name="typeList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
            {/foreach}
            </div>

        </div>
    </div>
            <div class="form-group item-func">
                <label class="control-label col-xs-12 col-sm-2">{:__('Func')}:</label>
                <div class="col-xs-12 col-sm-8">
                    {:build_checkboxs('row[func][]', $itemList,$row['func']);}
                </div>
            </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-desc" class="form-control" name="row[desc]" type="text" value="{$row.desc}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-weigh" class="form-control" name="row[weigh]" type="text" value="{$row.weigh}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('NewsId')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-news_id"  data-source="news/index" data-params='{"custom[type]":"news"}' class="form-control selectpage" name="row[news_id]" type="text" value="{$row.news_id}">
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>



<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
<script type="text/javascript">

    var jstype = "{$row.type}";
    typechange(jstype*1);
    $(document).on("change", "#c-type", function () {
        typechange($(this).val());

    })
    function typechange(type) {
        console.log(type)
        if (type == 2) {
            $('.item-func').hide();
        } else {
            $('.item-func').show();
        }
    }
</script>
